How to use 'append' ?

Hi guys,

i got a script that writes in a logfile every time it runs, but i dont want the last logs beeing overwritten, i've found the append function i dxl help, but i dont get it how to use this, can someone help me?

Currently i write this way:

logfile = write("h:\\logFile.csv")
.
.
.
logfile << dateAndTime(today) ";SET  '" access "'  for  '" itemName "'\n"

ManuelFelger - Mon May 11 10:30:38 EDT 2009

Re: How to use 'append' ?
SystemAdmin - Mon May 11 10:46:34 EDT 2009

Have you tried

logfile = append("h:\\logFile.csv")

?

Re: How to use 'append' ?
ManuelFelger - Mon May 11 11:26:06 EDT 2009

SystemAdmin - Mon May 11 10:46:34 EDT 2009
Have you tried

logfile = append("h:\\logFile.csv")

?

I've found out, its:
 

append(logFile, 437) << dateAndTime(today) ";Target  '" itemName "'  is not a Module!\n"

Re: How to use 'append' ?
llandale - Mon May 11 12:21:20 EDT 2009

Don't forget to close the stream, and therefore the file. Here is my function to do it. I see I should adjust the comments.
 

//************************
bool     fAppendFile(string FileContents, string NameFile)
{     // Append the message to the end of the File.
        // User should presumably add '\n' to the beginning
        // or end of the FileContents.
 
        Stream  Output
        noError()
        Output  = append(NameFile)
        string  ErrMess = lastError()
        if (null ErrMess)
        {  Output     << FileContents
           flush(Output)
           close Output
           return(true)
        }
        else
        {  return(false)
        }
}     // end fAppendFile()